package droidforum.co.diosapp.activities;

import droidforum.co.diosapp.R;
import droidforum.co.diosapp.R.layout;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

public class SplashDiosAppActivity extends Activity {
	
	private final int SPLASH_DISPLAY_LENGTH = 3000;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_app);
        Handler handler = new Handler();
        handler.postDelayed(getRunnableStartApp(), SPLASH_DISPLAY_LENGTH);
    }
    
    /**
	 * Metodo en el cual se debe incluir dentro de run(){Tu codigo} el codigo que se quiere realizar una
	 * vez ha finalizado el tiempo que se desea mostrar la actividad de splash 
	 * @return
	 */
	private Runnable getRunnableStartApp(){
    	Runnable runnable = new Runnable(){
        	public void run(){        		
        		Intent intent = new Intent(SplashDiosAppActivity.this, MainDiosAppActivity.class);
        		startActivity(intent);
        		finish();
        	}
    	};
    	
    	return runnable;
	}
}